import { Component, OnInit, AfterViewInit } from "@angular/core";
import { Store, Select } from "@ngxs/store";
import { Observable } from "rxjs";
import { SettingActions } from "../../setting-store";

@Component({
  selector: "n-display",
  templateUrl: "./display.component.html",
  styleUrls: ["./display.component.scss"]
})
export class DisplayComponent implements OnInit, AfterViewInit {
  @Select(state => state.setting.person) person$: Observable<string>;

  constructor(private store: Store) {}

  ngOnInit() {}

  ngAfterViewInit() {
    setTimeout(() => {
      this.store.dispatch(new SettingActions.Greeting("Galaxy"));
    }, 3000);
  }
}
